<template>
  <div class="my-counter">
    <button
      @click="goodsCount.goods_count--"
      type="button"
      class="btn btn-light"
    >
      -
    </button>
    <input
      type="number"
      v-model.number="goodsCount.goods_count"
      class="form-control inp"
    />
    <button
      @click="goodsCount.goods_count++"
      type="button"
      class="btn btn-light"
    >
      +
    </button>
  </div>
</template>

<script>
export default {
  props: {
    goodsCount: {
      type: Object,
      required: true,
    },
  },
  watch: {
    goodsCount: {
        deep:true,
      handler(val) {
          if(val.goods_count<1)val.goods_count=1
      },
    },
  },
};
</script>

<style lang="less" scoped>
.my-counter {
  display: flex;
  .inp {
    width: 45px;
    text-align: center;
    margin: 0 10px;
  }
  .btn,
  .inp {
    transform: scale(0.9);
  }
}
</style>